<?php
if (isset($_POST["update-comp"]))
	{
		$id = $_POST["id"];
		$query;
		$query= "update companies set ".
		 "name=\"".$_POST["name"]."\", status=\"".$_POST["status"]."\", contact=\"".$_POST["contact"]."\", ".
		 "country=\"".$_POST["country"]."\", address=\"".$_POST["address"]."\", ".
		 "web=\"".$_POST["web"]."\", size=\"".$_POST["size"]."\", notes=\"".$_POST["notes"]."\" ".", rank=\"".$_POST["rank"]."\" ";
		 if(isset($_POST["panel"]))
		 	$query .=  ", panel=\"".$_POST["panel"]."\", panelsize=\"".$_POST["panelsize"]."\"";
		 else 
			 $query .=  ", panel=\"0\", panelsize=\"0\"";
		 if(isset($_POST["system"]))
		 	$query .=  ", system=\"".$_POST["system"]."\"";
		 else 
			$query .=  ", system=\"0\"";
		 if(isset($_POST["knowhow"]))
		 	$query .=  ", knowhow=\"".$_POST["knowhow"]."\"";
		  else 
			$query .=  ", knowhow=\"0\"";	
		 if(isset($_POST["casro"]))
		 	$query .=  ", Casro=\"".$_POST["casro"]."\"";	
		  else 
			$query .=  ", Casro=\"0\"";
		 if(isset($_POST["esomar"]))
		 	$query .=  ", Esomar=\"".$_POST["esomar"]."\"";	
		  else 
			$query .=  ", Esomar=\"0\"";
		  if(isset($_POST["asianalliance"]))
		 	$query .=  ", asianalliance=\"".$_POST["asianalliance"]."\"";	
		  else 
			$query .=  ", asianalliance=\"0\"";
		  $query .=", edited=\"1\"";
		  $query .=", shortname=\"".$_POST["shortname"]."\"";
		  $query .=", moddate=\"".time()."\"";
		$query .= " where id=\"".$_POST["id"]."\"";
		$db = mysql_connect("mysql513.in.shared-server.net:16033", "JRtu434", "qvoiceDB1");
 		mysql_select_db("JRtu434", $db);
		mysql_query($query);	
		mysql_close;
		unset($_POST["update-comp"]);
	}
if (isset($_POST["contname"]) && (strlen($_POST["contname"])>1) )
{
	$db = mysql_connect("mysql513.in.shared-server.net:16033", "JRtu434", "qvoiceDB1");
 		mysql_select_db("JRtu434", $db);
		mysql_query("Insert into contacts (NAME,COMPID,EMAIL,COUNTRY,PHONE) values (\"".$_POST["contname"]."\",\"".$_POST["id"]."\",\"".$_POST["email"]."\",\"".$_POST["contcountry"]."\",\"".$_POST["countphone"]."\")");
		mysql_close;
}
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html lang="ja"> 
 
<!-- ==== document header ==== --> 
<head> 
<script SRC="jsfunctions.js"></script>	
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	var bindbehaviors = function(scope) {
  		$("#addpane").click(function(){
   			$("#slideout").slideToggle("slow");
  		});
  		$("#panel").click(function(){
    		$("#panelbox").slideToggle("fast");
  		});
 		$("#next").click(function(){
  			$("#change").load("dynamic.php?func=6&id="+$("#next").val(),function() {
     			bindbehaviors(this);
     		});
		});
		$("#new").click(function(){
  			$("#change").load("dynamic.php?func=6&id="+$("#new").val(),function() {
     			bindbehaviors(this);
     		});
		});
		$("#companyselect").change(function(){
  			$("#change").load("dynamic.php?func=6&id="+$("#companyselect").val(),function() {
     			bindbehaviors(this);
     		});
		});
		$("#prev").click(function(){
  			$("#change").load("dynamic.php?func=6&id="+$("#prev").val(),function() {
     			bindbehaviors(this);
     		});
		});
	};
bindbehaviors(this);
});
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<meta http-equiv="Content-Style-Type" content="text/css"> 
<meta http-equiv="Content-Script-Type" content="text/javascript"> 
<title>Company Editor</title>
</head>
<?php include "layout.php";?> 
<body>
<div id="content">
<div id="change">
<?php include "dynamic.php"; isset($_POST["id"])?companybrowser($_POST["id"]):companybrowser("1");?></div>
	</div>

</body>
</html>

